function isSupportedRule(selector) {
  return !selector.includes(":hover");
}

module.exports = function (config, root, opts) {
  root.walkRules(postrule => {
    if (postrule.parent.name === "media") {
      postrule.parent.remove();
    }

    if (!isSupportedRule(postrule.selector)) {
      postrule.remove();
    }

    postrule.walkDecls(decl => {
      if (decl.prop === "visibility") {
        switch (decl.value) {
          case "hidden":
            decl.replaceWith(decl.clone({ value: "collapse" }));
            return;
        }
      }

      if (decl.prop === "vertical-align") {
        switch (decl.value) {
          case "middle":
            decl.replaceWith(decl.clone({ value: "center" }));
            return;
        }
      }

      // if (!isSupportedProperty(decl.prop, decl.value)) {
      //   rule.removeChild(decl);

      //   if (rule.nodes.length === 0) {
      //     rule.remove();
      //   }
      // }
    });
  });
};
